package co2.bean;

import java.util.Map;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

import co2.pojos.Material;
import co2.pojos.Silabus;

@ManagedBean
@ViewScoped
public class DetailSilBean {

	private Silabus material;

	
	
	@PostConstruct
	public void postCon(){
		Map map = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
		if(map.get("silabusFromListContent")!=null){
			material = (Silabus) map.get("silabusFromListContent");
		}else{
			material = (Silabus) map.get("silabusFront");
		}
		
	}
	
	public String back(){

		Map map = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
		map.remove("silabusFromListContent");
		
		return "list_silabus";
	
	}
	public String back1(){
		Map map = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
		map.remove("silabusFront");
		
		return "user_silabus";
	}

	public Silabus getMaterial() {
		return material;
	}

	public void setMaterial(Silabus material) {
		this.material = material;
	}
	
}
